package com.yeban.bams.vo;

/**
 * @Desc TODO
 * @Author yeban
 * @Date 2025/10/18
 */
public class RankVo implements Comparable<RankVo>{

    private String personId;
    private String name;
    private Double total;

    public RankVo() {
    }

    public RankVo(String personId, String name, Double total) {
        this.personId = personId;
        this.name = name;
        this.total = total;
    }

    /**
     * 重写compareTo方法，比较的是总资产total
     * @param vo
     * @return
     */
    @Override
    public int compareTo(RankVo vo) {
        // 总资产相同，按照名字升序排列
        if(this.total == vo.total) {
            return this.getName().compareTo(vo.getName());
        }
        // 总资产按照降序排列
        return Double.compare(vo.total, this.total);
    }

    @Override
    public String toString() {
        return "RankVo{" +
                "personId='" + personId + '\'' +
                ", name='" + name + '\'' +
                ", total=" + total +
                '}';
    }

    /**
     * 获取
     * @return personId
     */
    public String getPersonId() {
        return personId;
    }

    /**
     * 设置
     * @param personId
     */
    public void setPersonId(String personId) {
        this.personId = personId;
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return total
     */
    public Double getTotal() {
        return total;
    }

    /**
     * 设置
     * @param total
     */
    public void setTotal(Double total) {
        this.total = total;
    }
}
